<?php
namespace app\index\controller;

use app\common\lib\Util;

use app\common\api\BayouSmsApi;
use app\common\api\SmsSingleSender;
use app\common\api\SmsSenderUtil;
use app\common\lib\Predis;
use app\common\lib\Rekey;

use app\common\lib\Task;



class Send
{
    public function index()
    {
		echo "asdfasdf";
		
		
		$phoneNum = $_GET['phone_num'];
		
		echo $phoneNum;
		
		/**
			if(empty($phoneNum)){
				return Util::show(0,"错误信息");	
				echo 
			}
		*/
		
		// 生成随机数
		$code = rand(1000,9999);
		
		$taskData = [
			'method'=>'sendSms',
			'data'=>[
				'mobile'=>$phoneNum,
				'code'=>$code,
			]
		];
		
		// $task = new Task();
		// $task->sendSms($taskData['data']);
		// print_r($taskData);
		
		$_POST['http_server']->task($taskData);
		
		return false;
		
		/**
		
		Predis::getInstance()->set(Rekey::smsKey($phoneNum), $code);
		
		try{
			$rsp = $this->sendByMobile($phoneNum,361678,'陕西今朝',array($code,5));   // 匹配验证码的
			
		}catch(\Exception $e){
			echo Util::show(0,"短信未发送成功");
		}
		$res = json_decode($rsp);
		
		if($res->){
			
		}
		print_r($res);
		*/
    }
	
	
	
}
